#!/usr/bin/python3
#输出乘法口诀
print("------------------------------------------------------------------")
print("for...in 实现输出乘法口诀：")
for i in range(1,10):
	for j in range(1,i+1):
		print('{}*{}={}\t'.format(i,j,i*j),end="")
	print()

for i in range(9,0,-1):
	for j in range(1,i+1):
		print('{}*{}={}\t'.format(i,j,i*j),end="")
	print()

for i in range(1,10):
	for j in range(1,i):
		print(end="        ")
	for k in range(i,10):
		print('{}*{}={}\t'.format(i,k,i*k),end="")
	print("")

for i in range(1,10):
	for j in range(1,10-i):
		print(end="        ")
	for k in range(10-i,10):
		print('{}*{}={}\t'.format(i,k,i*k),end="")
	print()

print("------------------------------------------------------------------")
print("while 实现输出乘法口诀：")
i=0
j=0
while i<9:
	i+=1
	while j<9:
		j+=1
		print('{}*{}={}\t'.format(i,j,i*j),end="")
		if i==j:
			j=0
			print("")
			break


i=10
j=0
while i>1:
	i-=1
	while j<9:
		j+=1
		print('{}*{}={}\t'.format(i,j,i*j),end="")
		if i==j:
			j=0
			print("")
			break

i=0
j=0
while i<9:
	j=i
	i+=1
	k=1
	while k<i:
		print("        ",end="")
		k+=1
	while j<9:
		j+=1
		print('{}*{}={}\t'.format(i,j,i*j),end="")
		if j==9:
			j=0
			print("")
			break 
i=0
j=0
while i<9:
	i+=1
	j=10-i
	k=1
	while k<10-i:
		print("        ",end="")
		k+=1
	while j<=9:
		print('{}*{}={}\t'.format(i,j,i*j),end="")
		j+=1
		if j==10:
			print("")
			break 

























